//package com.tiger.cloud.controller.crm;
//
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import com.tiger.cloud.common.jpush.JpushInterface;
//import com.tiger.cloud.filter.CurrentUserId;
//import com.tiger.cloud.filter.IgnoreAuth;
//import com.tiger.cloud.model.crm.LoanInfo;
//import com.tiger.cloud.model.crm.LoanInfoDetail;
//import com.tiger.cloud.model.crm.User;
//import com.tiger.cloud.model.crm.UserAccount;
//import com.tiger.cloud.model.crm.UserCompanyInfo;
//import com.tiger.cloud.model.crm.UserInfo;
//import com.tiger.cloud.service.crm.IUserAccountService;
//import com.tiger.cloud.service.crm.IUserCompanyInfoService;
//import com.tiger.cloud.service.crm.IUserInfoService;
//import com.tiger.cloud.service.crm.IUserService;
//import com.tiger.cloud.util.ErrorCode;
//import com.tiger.cloud.util.Response;
//import com.tiger.cloud.util.ResponseUtil;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import net.bytebuddy.utility.RandomString;
//
//@Controller
//@RequestMapping("test")
//@Api(value = "测试接口",tags = "测试")
//public class TestController{
//
//	@RequestMapping(value = "testGet06", method = RequestMethod.GET)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testGet06(){
//		return ResponseUtil.ok();
//	}
//	
//	 @Autowired
//	private JpushInterface ipushInterface;
//	@Autowired
//	private IUserService userService;
//	
//	@RequestMapping(value = "pushMessage", method = RequestMethod.POST)
//	@ResponseBody
//	@IgnoreAuth
//	public Response pushMessage(String alias){
//		Map<String, Object> params=new HashMap<String, Object>();
//		params.put("newCount",111);
//		ipushInterface.sendAllClientsPushMessage(Arrays.asList(alias),"有新朋友啦! "+new RandomString(32).nextString(), params);
//		return ResponseUtil.ok();
//	}
//	
//	@RequestMapping(value = "testPost11", method = RequestMethod.POST)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testPost01(@RequestBody LoanInfo loanInfo){
//		return ResponseUtil.ok();
//	}
//	
//	@RequestMapping(value = "loanInfoDetail", method = RequestMethod.POST)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testPost01(@RequestBody LoanInfoDetail loanInfoDetail){
//		return ResponseUtil.ok();
//	}
//	
//	
//	@RequestMapping(value = "testPost01", method = RequestMethod.POST)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testPost01(User user){
//		return ResponseUtil.ok(user);
//	}
//	
//	@RequestMapping(value = "testGet01", method = RequestMethod.GET)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testGet01(User user){
//		return ResponseUtil.ok(user);
//	}
//
//	@RequestMapping(value = "testPost02", method = RequestMethod.POST)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testPost02(@RequestBody User user){
//		return ResponseUtil.ok(user);
//	}
//	
//	@RequestMapping(value = "testGet02", method = RequestMethod.GET)
//	@ResponseBody
//	@IgnoreAuth
//	public Response testGet02(@RequestBody User user){
//		return ResponseUtil.ok(user);
//	}
//
//	
//	@RequestMapping(value = "testPost03", method = RequestMethod.POST)
//	@ResponseBody
//	public Response testPost03(@RequestBody User user){
//		return ResponseUtil.ok(user);
//	}
//	
//	@Autowired
//	private IUserInfoService userInfoService;
//	@Autowired
//	private IUserCompanyInfoService userCompanyInfoService;
//	@Autowired
//	private IUserAccountService userAccountService;
//	
//	@RequestMapping(value = "deleteUser", method = RequestMethod.GET)
//	@ResponseBody
//	@ApiOperation(value = "删除我的个人信息",notes = "删除我的个人信息")
//	public Response deleteUser(String mobile){
//		if(StringUtils.isEmpty(mobile)){
//			return ResponseUtil.error(ErrorCode.PARAMETER_INVALID,"mobile必传");
//		}
//		Map<String, Object> findMap=new HashMap<>();
//		findMap.put("login_id",mobile);
//		User user=userService.findOne(findMap);
//		if(user==null){
//			return ResponseUtil.error(ErrorCode.ERROR,"用户不存在!");
//		}
//		userService.remove(user);
//		findMap=new HashMap<>();
//		findMap.put("user_id",user.getId());
//		UserInfo userInfo=userInfoService.findOne(findMap);
//		if(userInfo!=null){
//			 userInfoService.remove(userInfo);
//		}
//		UserAccount userAccount=userAccountService.findOne(findMap);
//		if(userAccount!=null){
//			 userAccountService.remove(userAccount);
//		}
//		List<UserCompanyInfo> userCompanyInfos=userCompanyInfoService.find(findMap);
//		if(userCompanyInfos!=null){
//			for (UserCompanyInfo userCompanyInfo2 : userCompanyInfos) {
//				 userCompanyInfoService.remove(userCompanyInfo2);
//			}
//		}
//		return ResponseUtil.ok();
//	}
//	
//	@RequestMapping(value = "deleteUser", method = RequestMethod.GET)
//	@ResponseBody
//	@ApiOperation(value = "删除我的个人信息",notes = "删除我的个人信息")
//	public Response deleteUserPeersAndCustomer(String mobile){
//		if(StringUtils.isEmpty(mobile)){
//			return ResponseUtil.error(ErrorCode.PARAMETER_INVALID,"mobile必传");
//		}
//		Map<String, Object> findMap=new HashMap<>();
//		findMap.put("login_id",mobile);
//		User user=userService.findOne(findMap);
//		if(user==null){
//			return ResponseUtil.error(ErrorCode.ERROR,"用户不存在!");
//		}
//		userService.remove(user);
//		findMap=new HashMap<>();
//		findMap.put("user_id",user.getId());
//		UserInfo userInfo=userInfoService.findOne(findMap);
//		if(userInfo!=null){
//			 userInfoService.remove(userInfo);
//		}
//		UserAccount userAccount=userAccountService.findOne(findMap);
//		if(userAccount!=null){
//			 userAccountService.remove(userAccount);
//		}
//		List<UserCompanyInfo> userCompanyInfos=userCompanyInfoService.find(findMap);
//		if(userCompanyInfos!=null){
//			for (UserCompanyInfo userCompanyInfo2 : userCompanyInfos) {
//				 userCompanyInfoService.remove(userCompanyInfo2);
//			}
//		}
//		return ResponseUtil.ok();
//	}
//	
//	@RequestMapping(value = "testGet03", method = RequestMethod.GET)
//	@ResponseBody
//	@ApiOperation(value = "获取我的个人信息",notes = "获取我的个人信息")
//	public Response testGet03(@ApiParam(name="id",value="用户id",hidden=true) @CurrentUserId Long userId){
//		Map<String, Object> findMap=new HashMap<>();
//		findMap.put("userId",userId);
//		
//		Map<String, Object> datas=new HashMap<>();
//		datas.put("user", userService.get(userId));
//		datas.put("userInfo", userInfoService.find(findMap));
//		datas.put("userCompanyInfo", userCompanyInfoService.find(findMap));
//		datas.put("userAccount", userAccountService.find(findMap));
//		return ResponseUtil.ok(datas);
//	}
//
//}
